Skip to content

Hide pages and sections by adding hidden to frontmatter #2826

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: next
Choose a base branch
from

Conversation

bram-dingelstad
Copy link

@bram-dingelstad bram-dingelstad commented Mar 17, 2025

This feature is implemented based on discussion on the forum as well as #2391

Sanity check:

  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

Code changes

(Delete or ignore this section for documentation changes)

  • Are you doing the PR on the next branch?

If the change is a new feature or adding to/changing an existing one:

  • Have you created/updated the relevant documentation page(s)?

I've added hidden to both PageFrontMatter & SectionFrontMatter and made sure to filter them in the Paginator, which covers my use case.

Work that I can still do to bring this to completion:

  • Update documentation
  • Make sure it filters out of search index (not sure how to do this, would love pointers)
  • Make sure it filters out of any generated feed

Lemme know what y'all think ✨

@bram-dingelstad bram-dingelstad force-pushed the hide-pages-and-sections-by-adding-hidden-to-frontmatter branch 2 times, most recently from b0f9158 to ff4bfe4 Compare March 17, 2025 10:30
@bram-dingelstad bram-dingelstad force-pushed the hide-pages-and-sections-by-adding-hidden-to-frontmatter branch from ff4bfe4 to a80a744 Compare March 17, 2025 10:33
@@ -112,6 +112,10 @@ weight = 0
# A draft page is only loaded if the `--drafts` flag is passed to `zola build`, `zola serve` or `zola check`.
draft = false

# A hidden page is loaded and created, but won't be added to Paginators,
# set to true to hide page or false to override a parent section's `hidden = true`
hidden = false
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since hidden is a Option<bool> its good to default to false right? I was thinking of leaving it empty, implying the None state.
I assumed that people would get confused and since the None implies false with the inheritence rules specified above it, it should be fine!

Lemme know

@bram-dingelstad bram-dingelstad changed the title Hide pages and sections by adding hidden to frontmatter Hide pages and sections by adding hidden to frontmatter Mar 17, 2025
@tuyen-at-work
Copy link

Hi @bram-dingelstad,

I'm the initiator of the mentioned GitHub discussion, and I wanted to highlight some potential changes needed to exclude hidden pages from search:

Additional improvements:

@bram-dingelstad
Copy link
Author

Great suggestions @tuyen-at-work! I'll get to adding those when I have the time!
Thank you so much for taking the time 🙏🏻 ✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants